package com.yunc.user.config;

import com.yunc.common.web.interceptor.AuthIgnoreInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import javax.annotation.Resource;

/**
 * 拦截器加载的时间点在springcontext之前，而Bean又是由spring进行管理
 * 我们在注册拦截器之前，先将Interceptor 手动进行注入
 *
 * @author taocongcong
 * @create 2021-05-19 10:04
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Resource
    private AuthIgnoreInterceptor authIgnoreInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authIgnoreInterceptor).addPathPatterns("/api/**", "/sysDict/**");
    }

}
